package com.cskaoyan.controller.wx;

import com.cskaoyan.bean.bo.PageCommonParamBo;
import com.cskaoyan.bean.bo.TopicCommonBo;
import com.cskaoyan.bean.bo.TopicDetailBo;
import com.cskaoyan.bean.entity.Topic;
import com.cskaoyan.bean.vo.BasePageData;
import com.cskaoyan.bean.vo.BaseRespVo;
// TODO import com.cskaoyan.service.TopicService;
import com.cskaoyan.controller.wx.service.TopicService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * <h2> 小程序端 Topic Controller</h2>
 * @Author: GaoJia
 * @Date: 2021/10/21 09:39
 */
@RestController
@RequestMapping("wx/topic")
public class WxTopicController {

    @Resource
    TopicService topicService;

    /**
     * <h2> 专题 列表 </h2>
     * TODO List
     *  - 思路
     */
    @RequestMapping("list")
    public BaseRespVo list(PageCommonParamBo pageParam){
        BasePageData<TopicCommonBo> topics = topicService.list(pageParam);
        return BaseRespVo.ok(topics);
    }

    /**
     * <h2> 专题 详情 </h2>
     */
    @RequestMapping("detail")
    public BaseRespVo detail(Integer id){

        // wx/topic/detail?id=1046040
        TopicDetailBo topics = topicService.detail(id);
        return BaseRespVo.ok(topics);
    }

    /**
     * <h2> 专题 相关商品 </h2>
     */
    @RequestMapping("related")
    public BaseRespVo related(Integer id){

        // wx/topic/related?id=329
        BasePageData<Topic> topics = topicService.related(id);
        return BaseRespVo.ok(topics);
    }

}
